package com.gz.common.mongodb.support;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName MongoField
 * @Description // mongo查询字段的配置
 * @Author WHX
 * @Date 2021/8/20 14:59
 **/
@Getter
public class MongoField {
    private final Map<String, Integer> criteria = new HashMap<String, Integer>();

    public MongoField() {
    }

    public static MongoField init(){
        return new MongoField();
    }

    public MongoField include(String key) {
        criteria.put(key, Integer.valueOf(1));
        return this;
    }

    public MongoField exclude(String key) {
        criteria.put(key, Integer.valueOf(0));
        return this;
    }
}
